﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimTank
{
    public class Rune
    {
        public double firstRuneState;
        public double secondRuneState;
        private bool FirstIsDeath;
        private bool SecondIsDeath;

        public Rune()
        {
            FirstIsDeath = false;
            SecondIsDeath = false;
            firstRuneState = 1000;
            secondRuneState = 1000;
        }

        public void Recharge(double currentHastePercent)
        {
            double RechargeRate = (1 + currentHastePercent / 100);
            if (firstRuneState < 1000)
            {
                firstRuneState += RechargeRate;
            }
            else if (secondRuneState < 1000)
            {
                secondRuneState += RechargeRate;
            }
        }

        public bool Available()
        {
            if (firstRuneState >= 1000 || secondRuneState >= 1000)
                return true;
            else
                return false;
        }

        public void Use()
        {
            if (secondRuneState >= 1000)
                secondRuneState = 0;
            else if (firstRuneState >= 1000)
                firstRuneState = 0;
        }

        public void Refund()
        {
            if (firstRuneState == 0)
                firstRuneState = 1000;
            else if (secondRuneState == 0)
                secondRuneState = 1000;
        }
    }
}
